package com.ww.java.generic;

import java.util.Random;

public class InterfaceGenericDemo {
}

class FruitGenerator implements Generator<String> {

   private String[] fruits = new String[] { "apple", "banana", "pear" };

    @Override
    public String next() {
        Random random = new Random();
        return fruits[random.nextInt(3)];
    }
}

interface Generator<T> {
    T next();
}